import {DisplayZone, ObjectInformation} from "./event-types";

export function contains(element: ObjectInformation, zone: DisplayZone) {
    return element.x >= zone.x && element.x + element.width <= zone.x + zone.width &&
        element.y >= zone.y && element.y + element.height <= zone.y + zone.height;
}

export function containsPoint(point: {x: number, y: number} | undefined, element: ObjectInformation) {
    if (!point) {
        return false;
    }
    return point.x >= element.x && point.x <= element.x + element.width &&
        point.y >= element.y && point.y <= element.y + element.height;
}